let emp = {
    dept: {
        deptName: "peter"
    }
};
// console.log(emp.dept.deptName)

let deptName2 = emp?.dept?.deptName ?? "defaultValue";
console.log(deptName2)